/**
 * å¤éæ¡å¨é
 * @param window
 * @param jQuery
 */
!function(window,$){
	if(!window || !$){
		return 
	}
	
	var _itemClass = ".item-checkbox";
	
	var _allClass = ".all-checkbox";
	
	$.extend({
		
		clickCheckItem:function(that){
			stopPropagation();
			if($(that).is(":checked")){
				if($(_itemClass+":checked").length == $(_itemClass).length){
					$(_allClass).prop("checked",true);
				}else{
					$(_allClass).prop("checked",false);
				}
			}else{
				$(_allClass).prop("checked",false);
			}
		},
	
	    clickAllCheck:function(that){
	    	if($(that).is(":checked")){
	    		$(_itemClass).prop("checked",true);
	    	}else{
	    		$(_itemClass).prop("checked",false);
	    	}
	    },
	    
	    getCheckIds:function(){
	    	var ids = "";
	    	var i=0;
	    	$(_itemClass).each(function(index,ele){
	    		if($(this).is(":checked")){
	    			if(i==0){
		    			ids+=$(this).data("id");
		    		}else{
		    			ids+=","+$(this).data("id");
		    		}
	    			i++;
	    		}
	    	})
	    	return ids;
	    },
	})
	
	//é»æ­¢åç´ åä¸åæ³¡
	function stopPropagation(e) {  
        e = e || window.event;  
        if(e.stopPropagation) { //W3Cé»æ­¢åæ³¡æ¹æ³  
            e.stopPropagation();  
        } else {  
            e.cancelBubble = true; //IEé»æ­¢åæ³¡æ¹æ³  
        }  
    }

	
}(window,jQuery)